﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_ViewMenu.cshtml";
}
<link href="~/Content/After/css/base.css" rel="stylesheet" />
<script src="~/Content/BootstrapSouce/js/jquery.js"></script>
<script src="~/Content/BootstrapSouce/js/bootstrap.js"></script>
<script src="~/Content/BootstrapSouce/js/myAlert.js"></script>
<script>
    //需要加int类型识别
    $(function () {
        $("#addMedicalItem").click(function () {
            var MedicalItemDemo = new Array();
            MedicalItemDemo.push("<div class=\"four-line-txt check-search highLight deleteEle\" ")
            MedicalItemDemo.push("data-eid=\"\" data-pid=\"\" data-charged=\"\" data-source=\"5\">")
            MedicalItemDemo.push("<input type=\"text\" placeholder=\"检查项\" id=\"SeeDocMedicName\" name=\"SeeDocMedicName\" ")
            MedicalItemDemo.push(" class=\"Check-item zh-ipt recordIpt four-line-wenzi\" value=\"\" issug=\"1\">")
            MedicalItemDemo.push("<input type=\"text\" placeholder=\"次数\" id=\"SeeDocMedicNumber\" name=\"SeeDocMedicNumber\" class=\"check-num j_check_num\">")
            MedicalItemDemo.push("<span>￥<i class=\"examPrices\" id=\"SeeDocMedicSumPrice\" name=\"SeeDocMedicSumPrice\">0.00</i>")
            MedicalItemDemo.push("</span>")
            MedicalItemDemo.push(" <span class=\"deleteCheck\" onclick=\"CloseMedicalItem(this)\" id=\"closebutton\">×</span>")
            MedicalItemDemo.push("</div>")
            $("#SeeDoctorMedicalItem").append(MedicalItemDemo.join(""))
        })
        $("#addPrescrit").click(function () {
            var PrescritDemo = new Array();
            PrescritDemo.push("")
            PrescritDemo.push("<div class=\"five-line1 WestPrescription\" data-ischarged=\"\" data-prescription=\"\">")
            PrescritDemo.push(" <p class=\"chargeIcon\"></p>")
            PrescritDemo.push("  <p class=\"small-title\">")
            PrescritDemo.push("<span class=\"title\">成药处方<span class=\"WestPrescriptionSerialNum\" name=\"PrescritName\">2</span>:</span>")
            PrescritDemo.push(" <span class=\"deleteWestDrug drugBtn\" onclick=\"ClosePrescrit(this)\">删除该处方</span>")
            PrescritDemo.push("<span class=\"J_save_as_common_west_pre save-as-common\" onclick=\"SavePrescrit(this)\">存为常用处方</span>")
            PrescritDemo.push("</p>")
            PrescritDemo.push("<p class=\"drugItemTitle\">")
            PrescritDemo.push("<span class=\"drugNameTitle\">药品名称</span>")
            PrescritDemo.push("<span class=\"drugWayTitle\">用法</span>")
            PrescritDemo.push("<span class=\"drugFrequencyTitle\">用药频率</span>")
            PrescritDemo.push("<span class=\"drugChargeTitle\">单次剂量</span>")
            PrescritDemo.push("<span class=\"drugUnitTitle\">开药量</span>")
            PrescritDemo.push("</p>")
            PrescritDemo.push("<div class=\"WestPrescriptionList\">")
            PrescritDemo.push("<div class=\"way2 WestPrescriptionLists\" data-id=\"\" data-source=\"5\">")
            PrescritDemo.push("<input type=\"text\" name=\"DrugName\" class=\"medicinal-name zh-ipt recordIpt\" drugtype=\"100\">")
            PrescritDemo.push(" <input type=\"text\" name=\"DrugUsageName\" class=\"medicinal-way zh-ipt recordIpt\">")
            PrescritDemo.push("<input type=\"text\" name=\"DrugFrequencyName\" class=\"medicinal-frequency zh-ipt recordIpt\">")
            PrescritDemo.push(" <input type=\"text\" name=\"medicinal-dose\" class=\"medicinal-dose zh-ipt recordIpt\">")
            PrescritDemo.push("  <input type=\"text\" name=\"MeasuringUnitName\" class=\"medicinal-single zh-ipt recordIpt\">")
            PrescritDemo.push("<input type=\"text\" name=\"PrescritDrugNumber\" class=\"medicinal-charge zh-ipt recordIpt\">")
            PrescritDemo.push("  <input class=\"medicinal-unit zh-ipt recordIpt\" name=\"OpenDoseName\" value=\"\" price=\"\" type=\"text\" issug=\"0\">")
            PrescritDemo.push("<span class=\"univalent\">￥<em>0.00</em></span>")
            PrescritDemo.push(" <em class=\"deleteWestDrugList\" onclick=\"CloseDrupInfoList(this)\" name=\"deleteDrupInfoList\"></em>")
            PrescritDemo.push("<div class=\"medicinal-info\"></div>")
            PrescritDemo.push("</div>")
            PrescritDemo.push(" <div class=\"way2 WestPrescriptionLists\" data-id=\"\" data-source=\"5\">")
            PrescritDemo.push(" <input type=\"text\" name=\"DrugName\" class=\"medicinal-name zh-ipt recordIpt\" drugtype=\"100\">")
            PrescritDemo.push("<input type=\"text\" name=\"DrugUsageName\" class=\"medicinal-way zh-ipt recordIpt\">")
            PrescritDemo.push("<input type=\"text\" name=\"DrugFrequencyName\" class=\"medicinal-frequency zh-ipt recordIpt\">")
            PrescritDemo.push("<input type=\"text\" name=\"medicinal-dose\" class=\"medicinal-dose zh-ipt recordIpt\">")
            PrescritDemo.push("<input type=\"text\" name=\"MeasuringUnitName\" class=\"medicinal-single zh-ipt recordIpt\">")
            PrescritDemo.push(" <input type=\"text\" name=\"PrescritDrugNumber\" class=\"medicinal-charge zh-ipt recordIpt\">")
            PrescritDemo.push("<input class=\"medicinal-unit zh-ipt recordIpt\" name=\"OpenDoseName\" value=\"\" price=\"\" type=\"text\" issug=\"0\">")
            PrescritDemo.push("<span class=\"univalent\">￥<em>0.00</em></span>")
            PrescritDemo.push("<em class=\"deleteWestDrugList\" onclick=\"CloseDrupInfoList(this)\" name=\"deleteDrupInfoList\"></em>")
            PrescritDemo.push(" <div class=\"medicinal-info\"></div>")
            PrescritDemo.push(" </div>")
            PrescritDemo.push("<div class=\"way2 WestPrescriptionLists\" data-id=\"\" data-source=\"5\">")
            PrescritDemo.push("<input type=\"text\" name=\"DrugName\" class=\"medicinal-name zh-ipt recordIpt\" drugtype=\"100\">")
            PrescritDemo.push("<input type=\"text\" name=\"DrugUsageName\" class=\"medicinal-way zh-ipt recordIpt\">")
            PrescritDemo.push("<input type=\"text\" name=\"DrugFrequencyName\" class=\"medicinal-frequency zh-ipt recordIpt\">")
            PrescritDemo.push("<input type=\"text\" name=\"medicinal-dose\" class=\"medicinal-dose zh-ipt recordIpt\">")
            PrescritDemo.push("<input type=\"text\" name=\"MeasuringUnitName\" class=\"medicinal-single zh-ipt recordIpt\">")
            PrescritDemo.push(" <input type=\"text\" name=\"PrescritDrugNumber\" class=\"medicinal-charge zh-ipt recordIpt\">")
            PrescritDemo.push(" <input class=\"medicinal-unit zh-ipt recordIpt\" name=\"OpenDoseName\" value=\"\" price=\"\" type=\"text\" issug=\"0\">")
            PrescritDemo.push("<span class=\"univalent\">￥<em>0.00</em></span>")
            PrescritDemo.push("<em class=\"deleteWestDrugList\" onclick=\"CloseDrupInfoList(this)\" name=\"deleteDrupInfoList\"></em>")
            PrescritDemo.push(" <div class=\"medicinal-info\"></div>")
            PrescritDemo.push(" </div>")
            PrescritDemo.push(" </div>")
            PrescritDemo.push("<p class=\"add\"><span class=\"addWestPrescriptionList\" id=\"addDrupInfoList\">添加药品</span></p>")
            PrescritDemo.push(" </div>")
            $("#SeeDoctorPrescrit").append(PrescritDemo.join(""))
            $(".addWestPrescriptionList").click(function () {
                PrescritDrugDemoPush(this)
            })
        })
        $("#AddPriOrthor").click(function () {
            var AddPriOrthorDemo = new Array();
            AddPriOrthorDemo.push("<div class=\"addCostWay addWay way-search\" data-id=\"\" data-ischarged=\"0\">")
            AddPriOrthorDemo.push(" <input type=\"text\" placeholder=\"费用材料\" name=\"AddPriOrthorContent\" id=\"AddPriOrthorContent\" class=\"recordIpt material\" style=\"color: rgb(102, 102, 102);\">")
            AddPriOrthorDemo.push(" <a style=\"margin-top:8px\">￥</a>")
            AddPriOrthorDemo.push(" <input type=\"text\" name=\"AddPriOrthorPrice\" id=\"AddPriOrthorPrice\" class=\"zh-ipt numBox\" placeholder=\"0.00\">")
            AddPriOrthorDemo.push("<em class=\"deleApendCost\" name=\"deletePriOrthor\" onclick=\"ClosePriOrthor(this)\"></em>")
            AddPriOrthorDemo.push("</div>")
            $("#AddPriOrthorArray").append(AddPriOrthorDemo.join(""))
        })
        $(".addWestPrescriptionList").click(function () {
            PrescritDrugDemoPush(this)
        })

    })
    function PrescritDrugDemoPush(cLickBtn) {
        var PrescritDrugDemo = new Array();
        PrescritDrugDemo.push("<div class=\"way2 WestPrescriptionLists\" data-id=\"\" data-source=\"5\">")
        PrescritDrugDemo.push("<input type=\"text\" name=\"DrugName\" class=\"medicinal-name zh-ipt recordIpt\" drugtype=\"100\">")
        PrescritDrugDemo.push("<input type=\"text\" name=\"DrugUsageName\" class=\"medicinal-way zh-ipt recordIpt\">")
        PrescritDrugDemo.push("<input type=\"text\" name=\"DrugFrequencyName\" class=\"medicinal-frequency zh-ipt recordIpt\">")
        PrescritDrugDemo.push("<input type=\"text\" name=\"medicinal-dose\" class=\"medicinal-dose zh-ipt recordIpt\">")
        PrescritDrugDemo.push("<input type=\"text\" name=\"MeasuringUnitName\" class=\"medicinal-single zh-ipt recordIpt\">")
        PrescritDrugDemo.push(" <input type=\"text\" name=\"PrescritDrugNumber\" class=\"medicinal-charge zh-ipt recordIpt\">")
        PrescritDrugDemo.push(" <input class=\"medicinal-unit zh-ipt recordIpt\" name=\"OpenDoseName\" value=\"\" price=\"\" type=\"text\" issug=\"0\">")
        PrescritDrugDemo.push("<span class=\"univalent\">￥<em>0.00</em></span>")
        PrescritDrugDemo.push("<em class=\"deleteWestDrugList\" onclick=\"CloseDrupInfoList(this)\" name=\"deleteDrupInfoList\"></em>")
        PrescritDrugDemo.push(" <div class=\"medicinal-info\"></div>")
        PrescritDrugDemo.push(" </div>")
        var WestPrescriptionList = $(cLickBtn).parent().parent().find(".WestPrescriptionList");
        $(WestPrescriptionList).append(PrescritDrugDemo.join(""))
    }
    function CloseDiagnoInfo(e) {
        $(e).parent().remove()
    }
    function ClosePriOrthor(e) {
        $(e).parent().remove()
    }
    function CloseDrupInfoList(e) {
        var WestPrescriptionList = $(e).parent().parent().find(".WestPrescriptionLists");
        if (WestPrescriptionList.length <= 1) {
            $(e).parent().parent().parent().remove()
        }
        else {
            $(e).parent().remove()
        }
    }
    function ClosePrescrit(e) {
        $(e).parent().parent().remove()
    }
    function CloseMedicalItem(e) {
        $(e).parent().remove()
    }
</script>
<script>
    $(function () {
        ReciveRegistState0()
        //拼接挂号人选择
        $.ajax({
            type: "POST",
            url: "/RegistInfo/FnRegistInfoList",
            success: function (data) {
                var DataListDemo = new Array();
                for (var i = 0; i < data.length; i++) {
                    DataListDemo.push("<option value=\"")
                    DataListDemo.push(data[i].RegistId)
                    DataListDemo.push("\">")
                    DataListDemo.push(data[i].RegistChiName)

                    DataListDemo.push("</option>")
                }
                $("#PatientChiNames").append(DataListDemo.join(""))
            },
            error: function (data) {
                MyAlert("提示", "错误", "确认", false, "warning")
            }
        })
        //拼接就诊项选择
        $.ajax({
            type: "POST",
            url: "/RegistInfo/FnRegistInfoList",
            success: function (data) {
                var DataListDemo = new Array();
                for (var i = 0; i < data.length; i++) {
                    DataListDemo.push("<option value=\"")
                    DataListDemo.push(data[i].RegistId)
                    DataListDemo.push("\">")
                    DataListDemo.push(data[i].RegistChiName)

                    DataListDemo.push("</option>")
                }
                $("#PatientChiNames").append(DataListDemo.join(""))
            },
            error: function (data) {
                MyAlert("提示", "错误", "确认", false, "warning")
            }
        })
    })
    function PatientChiNameChange(e) {
        $.ajax({
            type: "POST",
            url: "/RegistInfo/FnGetRegistInfoModel",
            data:{
                RegistId:$(e).val()
            },
            success: function (data) {
                if (data.RegistChiName != null) {
                    $("#PatientChiName").val(data.RegistChiName).attr("disabled", "disabled")
                    $("input[type=radio][name=PatientSex][value=" + data.RegistSex + "]")[0].checked = true
                    $("input[type=radio][name=PatientSex]").attr("disabled", "disabled")
                    $("#PatientAge").val(data.RegistAge)
                }
            },
            error: function (data) {
                MyAlert("提示", "错误", "确认", false, "warning")
            }
        })
    }
    //查询当前待诊人数
    function ReciveRegistState0() {
        $.ajax({
            type: "POST",
            url: "/RegistInfo/FnRegistInfoCount",
            success: function (data) {
                $("#receive-btn").html("接诊(" + data + ")")
                if (data == 0) {
                    $("#receive-btn").attr("disabled", "disabled")
                }
            },
            error: function (data) {
                MyAlert("提示", "错误", "确认", false, "warning")
            }
        })
    }

    //按顺序进行接诊并修改状态
    function ReciveRegistInfo() {
        $.ajax({
            type: "POST",
            url: "/RegistInfo/FnRegistInfoTopRegistId",
            success: function (data) {
                if (data.RegistChiName != null) {
                    ReciveRegistState0()
                    $("#PatientChiName").val(data.RegistChiName).attr("disabled", "disabled")
                    $("input[type=radio][name=PatientSex][value=" + data.RegistSex + "]")[0].checked = true
                    $("input[type=radio][name=PatientSex]").attr("disabled", "disabled")
                    $("#PatientAge").val(data.RegistAge)
                }
            },
            error: function (data) {
                MyAlert("提示", "错误", "确认", false, "warning")
            }
        })

    }
</script>
<div id="urHere">DouPHP 管理中心<b>&gt;</b><strong>挂号信息</strong> </div>
<div style="width:100%">
    <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">
        <h3>门诊处方</h3>
        <span id="receive-btn" onclick="ReciveRegistInfo()" class="btn btn-info">接诊</span><span class="btn btn-info" style="margin-left:20px">保存</span>
        <div class="cloudClinic-box">
            <div class="cloudClinic-main-container">
                <div class="main-header">
                    <div class="first-line">
                        <p class="single-information name">
                            <b class="info-must">*</b><b>姓名:</b>
                            <input type="text" id="PatientChiName" name="PatientChiName" onchange="PatientChiNameChange(this)" list="PatientChiNames" class="patient-name zh-ipt recordIpt mustInt p_patientName" issug="1">
                            <datalist id="PatientChiNames"></datalist>

                        </p>
                        <p class="single-information sex" style="">
                            <b class="info-must">*</b><b>性别:</b>
                            <input name="PatientSex" type="radio" value="1" />男
                            <input name="PatientSex" type="radio" value="2" />女
                        </p>
                    </div>
                    <div class="second-line">
                        <p class="single-information">
                            <b class="info-must">*</b>
                            <b>年龄:</b>
                            <input id="PatientAge" type="text" name="PatientAge" class="patient-age recordIpt mustInt p_age">
                            <div tabindex="0" class="ui-select-wrap " style="width: 35px;">
                                <div class="ui-select-input" title="岁" key="岁">岁</div>
                            </div>
                        </p>
                        <p class="single-information phone">
                            <b>电话:</b>
                            <input type="text" name="PatientPhone" id="PatientPhone" class="phone-num zh-ipt recordIpt p_patientPhone">
                        </p>
                    </div>
                    <div class="first-patient-history autoHeight">
                        <span class="autoTitle">往病史:</span>
                        <div id="CaseDisease" name="CaseDisease" class="patient-old recordIpt autoIpt gr-border J_divEditable" contenteditable="true">

                        </div>
                        <div class="patient-old-text"></div>
                    </div>
                    <div class="patient-history2 autoHeight">
                        <span class="autoTitle">过敏史:</span>
                        <div id="CaseAllergy" name="CaseAllergy" class="patient-history2 zh-ipt2 recordIpt autoIpt p_allergyHistory gr-border J_divEditable" contenteditable="true">

                        </div>
                    </div>
                </div>
                <div class="main-mid2">
                    <div class="there-line">
                        <b class="info-must">*</b><b>诊断:</b>
                        <div class="pos">
                            <ul class="holder">
                                <li class="bit-input" id="annoninput">
                                    <input type="text" list="DiagnoInfoNames" class="maininput recordIpt" maxlength="50">
                                    <datalist id="DiagnoInfoNames"></datalist>
                                </li>
                                <li val="ssdd" class="bit-box" name="DiagnoInfoName">
                                    <span name="DiagnoInfoName_1" title="ssdd">ssdd</span>
                                    <span class="closebutton" onclick="CloseDiagnoInfo(this)" id="closebutton">×</span>
                                </li>
                                <li val="ssdd" class="bit-box">
                                    <span name="DiagnoInfoName_1" title="ssdd">ssdd</span>
                                    <span class="closebutton" onclick="CloseDiagnoInfo(this)" id="closebutton">×</span>
                                </li>
                            </ul>
                            <textarea name="" id="hmSelect" class="diagnosis mustInt recordIpt p_symptom" oninput="this.style.height = this.scrollHeight + 'px';" style="display: none;"></textarea>
                        </div>
                    </div>
                </div>
                <!-- - - - - - - - - - - 检查医疗项- - - - - - - - - - -->
                <div class="main-mid3 f-ps">
                    <div class="four-line">
                        <b>检查治疗项:</b>
                        <span class="short-btn addCheck" id="addMedicalItem">添加</span>
                        <div class="check-item" id="SeeDoctorMedicalItem">
                            <div class="chargeIcon"></div>

                        </div>
                    </div>
                </div>
                <!-- - - - - - - - - - - 处方 - - - - - - - - - - -->
                <div class="main-mid4 f-ps" style="margin:0px  60px">
                    <div class="prescriptions">
                        <b style="font-size: 14px;">处方:</b>
                        <span class="addWestDrug long-btn" id="addPrescrit">添加处方</span>
                    </div>
                    <div class="westDrug" id="SeeDoctorPrescrit">

                    </div>
                </div>
                <!-- - - - - - - - - - - 附加费用 - - - - - - - - - - -->
                <div class="main-mid6 f-ps" style="margin:0px  10px">
                    <div class="four-line1">
                        <b>附加费用:</b>
                        <span class="short-btn addCost" id="AddPriOrthor">添加</span>
                        <div class="addCosts">
                            <div class="addCosts-main">
                                <div class="chargeIcon"></div>
                                <!--  <p class="small-title"><span class="title">附加费用</span><span class="deleteAddCosts">删除</span></p> -->
                                <div class="addCost-way" id="AddPriOrthorArray">

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- - - - - - - - - - - 医嘱- - - - - - - - - - -->
                <div class="doctorSay autoHeight">
                    <span class="autoTitle">医嘱:</span>
                    <div class="single-line">
                        <div id="DocAdviceContent" name="DocAdviceContent" class="zh-ipt2 recordIpt autoIpt2 gr-border J_divEditable J_advice_content" contenteditable="true"></div>
                        <div class="advice-temp J_advice_temp">...</div>
                    </div>
                </div>
                <!-- - - - - - - - - - - 合计- - - - - - - - - - -->
                <div class="main-mid7">
                    <div class="four-line2">
                        <span class="totalAmount">合计金额：<em>￥<i style="font-weight: bold"> 0.00</i></em></span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


